﻿using pbvs.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace pbvs.Data.Repositories.RepositoryExtensions
{
    public static class ContentRepositoryExtensions
    {
        public static IQueryable<ContentPage> ByPageName(this IQueryable<ContentPage> query, string pageName)
        {
            if (!string.IsNullOrEmpty(pageName))
            {
                query = from q in query where q.PageName.ToLower() == pageName.ToLower() select q; 
            }
            return query;
        }

        public static IQueryable<ContentPage> ById(this IQueryable<ContentPage> query, int? id)
        {
            if (id.HasValue)
            {
                query = from q in query where q.Id == id.Value select q;
            }
            return query;
        }
    }
}